package com.projects.android.views;

import android.app.ListActivity;
import android.os.Bundle;
import android.text.Html;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.widget.TextView;

import com.projects.android.R;
import com.projects.android.bus.FoodDetailBUS;
import com.projects.android.dto.FoodDetailDTO;
import com.projects.android.utils.SelectedItems;

public class FoodDetail extends ListActivity {
	private TextView mWebView;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fooddetail);

		mWebView = (TextView) findViewById(R.id.webviewRestaurantInfo);
		mWebView.setMovementMethod(new ScrollingMovementMethod());
		
		FoodDetailDTO detail = FoodDetailBUS.selectByID(SelectedItems.SelectedFood.getID());
		Log.i("FoodDetail", detail.getIntroduction());
		
		StringBuilder builder = new StringBuilder();
		builder.append("<html><body>");
		builder.append(detail.getIntroduction());
		builder.append("</body></html>");
		mWebView.setText(Html.fromHtml(builder.toString()));
	}
}
